<?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');
class City_model extends MY_Model
{
    private $table = 'city';
	public function __construct()
	{
		parent::__construct($this->table);
	
	}
	
	/**
	 * 获取用户列表
	 * */
	public function getProvinceList()
	{	 
	    $this->db->order_by('provinceId','asc');
	    return $this->db->get( 'province' )->result_array();
	}
	
	/**
	 * 获取单条省份信息
	 * */
	public function getProvinceRow( $provinceId=0 )
	{
	    $this->db->where('provinceId',$provinceId);
	    return $this->db->get( 'province' )->row_array();
	}
	
	public function getCity( $provinceId=0 )
	{
	    
	    if ($provinceId){
	        $this->db->where('provinceId',$provinceId);
	    }
	    
	    $this->db->order_by('displayOrder','asc');
	    $query = $this->db->get($this->table);
	    return $query->result_array();
	}
	
	/**
	 * 获取单条省份信息
	 * */
	public function getCityRow( $cityId=0 )
	{
	    $this->db->where('cityId',$cityId);
	    return $this->db->get($this->table)->row_array();
	}
}
?>